package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"moxue_rpc/moxueclient"
)

type ServiceContext struct {
	Config    config.Config
	AuthToken rest.Middleware
	Moxue     moxueclient.Moxue
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:    c,
		AuthToken: middleware.NewAuthTokenMiddleware().Handle,
		Moxue:     moxueclient.NewMoxue(zrpc.MustNewClient(c.Moxue)),
	}
}
